#include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct
{
	int nb;
	char nm[21];
	float sco[4];
}stu;
int main()
{
   int n,i,maxi;
   stu *p;
   float num,max;
   while((scanf("%d",&n))!=EOF)
   {
   	  p=(stu *)calloc(n,sizeof(stu));
   	  for(i=0;i<n;i++)
   	  {
   	  	scanf("%d %s %f %f %f %f",&(p+i)->nb,&(p+i)->nm,&(p+i)->sco[0],&(p+i)->sco[1],&(p+i)->sco[2],&(p+i)->sco[3]);
   	    num=(p+i)->sco[0]+(p+i)->sco[1]+(p+i)->sco[2]+(p+i)->sco[3];
		if(num>=max)
		{
			max=num;
			maxi=i;
		}
	  }
	  printf("%d %s\n",(p+maxi)->nb,(p+maxi)->nm);
   }
   return 0;      
}